//
//  ZGCustomKeyboard.m
//  NewBee
//
//  Created by leergou on 16/8/22.
//  Copyright © 2016年 WhiteHouse. All rights reserved.
//

#import "ZGCustomKeyboard.h"

@interface  ZGCustomKeyboard()<UIPickerViewDelegate,UIPickerViewDataSource>

/* pickerView */
@property (nonatomic,strong) UIPickerView *pickerView;

/* topToolBar */
@property (nonatomic,strong) UIView *customKeyboard;

@property (nonatomic,copy) NSString *currentCity;


@end

@implementation ZGCustomKeyboard

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
    }
    return self;
}

#pragma mark - 重写城市数组 set方法


#pragma mark - 设置 UI -
- (void)setupUI {
    
    UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:self.bounds];
    
    pickerView.delegate = self;
    pickerView.dataSource = self;
    
    [pickerView selectRow:0 inComponent:0 animated:NO];
    
    [self addSubview:pickerView];
    
}

#pragma mark - pickerView datasource * delegate -
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{

    return self.cityList.count;
}

- (NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerView{
    return 1;
}

- (CGFloat) pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component{
    
    return 50;
}

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
    
    UILabel *label = [[UILabel alloc] init];
    
    label.text = self.cityList[row];
    
    label.font = [UIFont systemFontOfSize:20];
    
    label.textAlignment = NSTextAlignmentCenter;
    
    return label;
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{

    if (self.selectCity) {
        self.selectCity(self.cityList[row]);
    }
    
}

#pragma mark - lazy -






@end
